package com.atguigu.math;

import org.junit.jupiter.api.Test;

import java.util.Random;

public class TestRandom {
    @Test
    public void test1(){
        //Random 专门产生随机数
        Random random = new Random();

        double d = random.nextDouble();
        int i = random.nextInt();
        boolean b = random.nextBoolean();
        System.out.println("d = " + d);//[0,1)
        System.out.println("i = " + i);//int范围的任意值
        System.out.println("b = " + b);//true或false
    }

    @Test
    public void test2(){
        //Random 专门产生随机数
        Random random = new Random();
        int i = random.nextInt(100);//[0,100)
        int j = random.nextInt(100, 150);//[100,150)
        System.out.println("i = " + i);
        System.out.println("j = " + j);
    }
}
